home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1997: The Complete Utilities Toolkit / macworld-complete-utilities-1997.iso / Desktop ⁄ Finder / FinderProgressBar 2.0 / FinderProgressBar.h < prev    next >
Encoding:
Text File  |  1995-03-10  |  3.3 KB  |  63 lines  |  [TEXT/MMCC]

  1. /*****************************************************************************************************
  2. *                                                                                                    *
  3. * FinderProgressBar.h - Copyright 1993 - 1995 Chris Larson (larson@cs.ucla.edu), All rights reserved *
  4. *                                                                                                    *
  5. * This is the public header file for a CDEF which mimics the progress bar used by the Finder. This   *
  6. * file and compiled derivatives may be freely used within any freeware/shareware/postcardware/… as   *
  7. * long as you mention my name in your credits. Neither this source nor its compiled derivatives are  *
  8. * in the public domain and may not be use in any form in public domain software. Neither this source *
  9. * nor its compiled derivatives may be used in any form in a commercial product without the expressed,*
  10. * written consent of the author (me).                                                                *
  11. *                                                                                                    *
  12. * Version 2.0 -- March 10, 1995.                                                                     *
  13. *                                                                                                    *
  14. *****************************************************************************************************/
  15.  
  16. // Constants
  17.  
  18. #define cFPBFrameColorID    0    // The id of the frame color in a Bar’s color table.
  19. #define cFPBBodyColorID        1    // The id of the background color in a Bar’s color table.
  20. #define cFPBBarColorID        2    // The id of the bar color in a Bar’s color table.
  21.  
  22. #define    kFPBResourceID        200    // The Resource ID of our CDEF.
  23.  
  24. #define    kFPBDefaultVarCode        0    // Default variation code.
  25. #define    kFPBCustomColorVarCode    1    // Variation code indicating use of control color table.
  26.  
  27. #define progressBarProc        ( 16 * ( kFPBResourceID ) + ( kFPBDefaultVarCode ) )
  28. #define customColorBarProc    ( 16 * ( kFPBResourceID ) + ( kFPBCustomColorVarCode ) )
  29.  
  30. #define kInProgressBarControlPart    50
  31.  
  32. #define kFPBFrameCount    16    // The number of frames in the “Barber Pole” animation loop.
  33.  
  34. //-----
  35. // short GetProgressBarAnimationFrame(ControlHandle theControlHandle);
  36. //-----
  37. #define GetProgressBarAnimationFrame(theControlHandle)    \
  38.             ( GetControlReference(theControlHandle) & 0x0000FFFF )
  39.  
  40. //-----
  41. // void SetProgressBarAnimationFrame(ControlHandle theControlHandle, short frameNumber);
  42. //-----
  43. #define SetProgressBarAnimationFrame(theControlHandle,frameNumber)    \
  44.             { SetControlReference(theControlHandle,(0x7FFF0000 | ((frameNumber) % kFPBFrameCount))); \
  45.               Draw1Control(theControlHandle); }
  46.  
  47. //-----
  48. // void IncrementProgressBarAnimationFrame(ControlHandle theControlHandle, short increment);
  49. //-----
  50. #define IncrementProgressBarAnimationFrame(theControlHandle,increment)    \
  51.             SetProgressBarAnimationFrame(theControlHandle, \
  52.                                          GetProgressBarAnimationFrame(theControlHandle) + (increment))
  53.  
  54. //-----
  55. // void StartProgressBarAnimation(ControlHandle theControlHandle);
  56. //-----
  57. #define StartProgressBarAnimation(theControlHandle) SetProgressBarAnimationFrame(theControlHandle,0)
  58.  
  59. //-----
  60. // void StopProgressBarAnimation(ControlHandle theControlHandle);
  61. //-----
  62. #define StopProgressBarAnimation(theControlHandle) SetControlReference(theControlHandle,0);
  63.